/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "ecole")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ecole.findAll", query = "SELECT e FROM Ecole e"),
    @NamedQuery(name = "Ecole.findByNom", query = "SELECT e FROM Ecole e WHERE e.nom = :nom"),
    @NamedQuery(name = "Ecole.findByClassement", query = "SELECT e FROM Ecole e WHERE e.classement = :classement"),
    @NamedQuery(name = "Ecole.findByPaysDOrigine", query = "SELECT e FROM Ecole e WHERE e.paysDOrigine = :paysDOrigine")})
public class Ecole implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NOM")
    private String nom;
    @Basic(optional = false)
    @Column(name = "CLASSEMENT")
    private int classement;
    @Basic(optional = false)
    @Column(name = "PAYS_D_ORIGINE")
    private String paysDOrigine;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ecole")
    private Collection<Etudier> etudierCollection;

    public Ecole() {
    }

    public Ecole(String nom) {
        this.nom = nom;
    }

    public Ecole(String nom, int classement, String paysDOrigine) {
        this.nom = nom;
        this.classement = classement;
        this.paysDOrigine = paysDOrigine;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public int getClassement() {
        return classement;
    }

    public void setClassement(int classement) {
        this.classement = classement;
    }

    public String getPaysDOrigine() {
        return paysDOrigine;
    }

    public void setPaysDOrigine(String paysDOrigine) {
        this.paysDOrigine = paysDOrigine;
    }

    @XmlTransient
    public Collection<Etudier> getEtudierCollection() {
        return etudierCollection;
    }

    public void setEtudierCollection(Collection<Etudier> etudierCollection) {
        this.etudierCollection = etudierCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nom != null ? nom.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ecole)) {
            return false;
        }
        Ecole other = (Ecole) object;
        if ((this.nom == null && other.nom != null) || (this.nom != null && !this.nom.equals(other.nom))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Ecole[ nom=" + nom + " ]";
    }
    
}
